<!--
 * @Author: your name
 * @Date: 2021-09-07 11:19:36
 * @LastEditTime: 2021-09-07 11:35:07
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \briup\5-javascript\day12\9-鼠标事件.html
-->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>鼠标事件</title>
    <style>
        #app {
            width: 100px;
            height: 100px;
            border: 1px solid green;
        }
    </style>
</head>

<body>
    <div id="app">

    </div>
</body>
<script>
    var div = document.getElementById("app");
    // console.log(div);
    var handler = function(event) {
        console.log(event.type);
        // switch (event.type) {
        //     case "click":
        //         console.log("鼠标点击");
        //     case "mouseover":
        //         console.log("光标移入");
        //         break;
        // }

    }
    div.onclick = handler;
    div.onmouseover = handler;
    div.onmousedowm = handler;
    // div.onmousemove = handler;
    //坐标点
    div.onclick = function(event) {
        console.log("页面坐标位置:" + event.pageX + "," + event.pageY);
        console.log("屏幕坐标位置:" + event.screenX + "," + event.screenY);
        console.log("客户区坐标位置:" + event.clientX + "," + event.clientY);
    }
</script>

</html>